package com.harboursoftware.xstorage.results;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

/**
 * 
 * @author Simon Leung
 * @since 0.1
 */
public abstract class XMLResult extends Result {
    
    public XMLResult() {
        setHeaderContentTypt("application/xml");
    }

    public abstract String toXML();

    @Override
    public InputStream getInputStream() throws IOException {
        return IOUtils.toInputStream(toXML(), "UTF-8");
    }

    /**
     * unspported
     */
    @Override
    public void setInputStream(InputStream inputStream) {
        throw new UnsupportedOperationException("setInputStream is unspported");
    }
}
